package com.jake.rabbitbootdemo.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {

    @Bean
    public Queue directQueue1() {
        return new Queue("jake.direct.queue.1");
    }

    @Bean
    public Queue directQueue2() {
        return new Queue("jake.direct.queue.2");
    }

    @Bean
    public Queue directQueue3() {
        return new Queue("jake.direct.queue.3");
    }

    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange("jake.direct.exchange");
    }

    @Bean
    public Binding bindQueue1() {
        return BindingBuilder.bind(directQueue1()).to(directExchange()).with("jake.direct.routingKey.1");
    }

    @Bean
    public Binding bindQueue2() {
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("jake.direct.routingKey.2");
    }

    @Bean
    public Binding bindQueue3() {
        return BindingBuilder.bind(directQueue3()).to(directExchange()).with("jake.direct.routingKey.3");
    }

}
